1. Field of the Invention
The present invention relates to an image processing apparatus and an image processing method.
2. Description of Related Art
Thinning processing is known as an image processing. In thinning processing, sharpness of character and the like is improved by decreasing the pixel values at the edges of the characters and the like.
Smoothing processing is another image processing to be performed on edges. In smoothing processing, edges of an oblique line portion can be smoothed visually by making the edges be halftone by increasing or decreasing pixel values at the edges of the oblique line portion or a character and the like.
Both of thinning processing and smoothing processing are performed on edges. However, it has been difficult to perform the two processing at the same time because the objects of the two processing are different. For example, although a sharp and smooth character can be obtained when thinning processing is performed on straight line portions and smoothing processing is performed on oblique line portions of a character, it is difficult to obtain such a character by a method of detecting structures of the straight line portions and the oblique line portions and switching between thinning processing and smoothing processing depending on the detected structure (see Japanese Patent Application Laid Open Publication No. H7-334672, for example). This is because there are pixels belonging to both straight line portion and the oblique line portion, causing an unexpected result such as increase in pixel value due to smoothing processing although thinning, not smoothing, should have been the appropriate processing.
In response to this, the applicant developed an image processing apparatus to realize thinning processing and smoothing processing at the same time (see Japanese Patent No. JP 4225337, for example). According to this image processing apparatus, results of smoothing processing and thinning processing are stored as change amounts from the original pixel value. When a pixel value obtained by adding the stored change amounts to the original pixel value exceeds that maximum value or becomes a negative value, the excess or shortfall is adjusted by using the pixel value of an adjacent pixel which has a predetermined positional relation with the target pixel. By adjusting the processing results of thinning processing and smoothing processing not only in the target pixel by in two pixels which the target pixel and an adjacent pixel thereof, the two processing results can be absorbed reasonably.
According to the above described image processing apparatus, common templates are used in smoothing processing and thinning processing. In each template, the positional relation between the target pixel and an adjacent pixel to be used for adjusting the pixel value of the target pixel is defined, and in addition, change amounts in pixel value due to smoothing processing and thinning processing of each of the target pixel and the adjacent pixel are defined. A pair of target pixel and adjacent pixel, which are the pixels in which pixel value adjustment is to be performed, is decided by carrying out template matching, and pixel values of the target pixel and the adjacent pixel when the two processing are performed at the same time are obtained.
In such template method, thinning processing and smoothing processing are performed in a unified manner by using the templates. That is, the templates need to be newly prepared in order to switch between smoothing processing and thinning processing because there is no border between thinning processing and smoothing processing in the templates and the two processing are not independent from each other. Although the processing may be switched without newly preparing the templates, an appropriate processing result cannot be obtained because the judgment criteria of edges in each of thinning processing and smoothing processing differs from each other.
However, there are various processing methods in thinning processing and smoothing processing, and it will be convenient if the processing can be switched between each other.